package com.wangpu.oa;

import java.util.Properties;


public class Application {
	private final static Properties CONFIG=new Properties();
	public static int ONLINE_USER_COUNT=0;
	static {
		init();
	}
	
	private static void init() {
		try {
			CONFIG.load(Application.class.getResourceAsStream("/config.properties"));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static String getString(String key,String defaultValue) {
		return CONFIG.getProperty(key, defaultValue);
	}
	
	public static int getInt(String key,int defaultValue) {
		String value=CONFIG.getProperty(key);
		if(value==null) {
			return defaultValue;
		}
		value=value.trim();
		if(value.length()==0) {
			return defaultValue;
		}
		return Integer.parseInt(value);
	}
}
